#ifndef PROGRAM_DATA_H
#define PROGRAM_DATA_H

#include <string>
#include <sys/stat.h>

namespace cnc {

	namespace compiler {

		class ProgramData
		{
			const std::string name_;
			void operator=(ProgramData &);
		public:
			ProgramData(const std::string name) : name_(name)
			{
			}
			const std::string getName() const
			{
				return name_.substr(name_.find_last_of("/\\") + 1);//.c_str();
			}
			const size_t getSize() const
			{
				struct stat st;
				if (stat(name_.c_str(), &st) < 0)
					return 0;
				return st.st_size;
			}
			const time_t getDate() const
			{
				struct stat st;
				if (stat(name_.c_str(), &st) < 0)
					return 0;
				return st.st_mtime;
			}
		};
	
	} // namespace compiler
	
} // namespace cnc

#endif

